<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>Fake</title>
    <link type="text/css" href="css/css.css" rel="stylesheet"/>
    <link rel="stylesheet" href="css/layer.css">
    <script type="text/javascript" src="js/jquery-3.2.1.js"></script>
    <script type="text/javascript" src="js/js.js"></script>
    <script src="js/wb.js" type="text/javascript" charset="utf-8"></script>
    <script src="js/MagicZoom.js" type="text/javascript"></script>
    <link rel="stylesheet" href="css/layui.css">
    <script src="js/layer/layer.js"></script>
    <script src="js/wb.js" type="text/javascript" charset="utf-8"></script>
</head>

<body style="background-color: white">
<div class="mianCont">
    <div class="top">
        <span id="xianshiquyu">欢迎来到Fake 请&nbsp;<a href="login-register.html">[登录/注册]</a></span>
        <span class="topRight">
    <a href="vip.html">Fake</a>&nbsp;|
    <a href="order.html">我的订单</a>&nbsp;| 
    <a href="vip.html">会员中心</a>&nbsp;|
    <a href="contact.html">联系我们</a>
   </span>
    </div><!--top/-->
    <div class="lsg">
        <h1 class="logo"><a href="index.html"><img src="images/logoA.png" width="280" height="81"/></a></h1>
        <form action="#" method="get" class="subBox">
            <div class="subBoxDiv">
                <input type="text" class="subLeft"/>
                <input type="image" src="images/subimg.png" width="63" height="34" class="sub"/>
                <div class="hotWord">
                    热门搜索：
                    <a href="proinfo.html">冷饮杯</a>&nbsp;
                    <a href="proinfo.html">热饮杯</a> &nbsp;
                    <a href="proinfo.html">纸杯</a>&nbsp;
                    <a href="proinfo.html">纸巾</a> &nbsp;
                    <a href="proinfo.html">纸巾</a> &nbsp;
                    <a href="proinfo.html">纸杯</a>&nbsp;
                </div><!--hotWord/-->
            </div><!--subBoxDiv/-->
        </form><!--subBox/-->
        <div class="gouwuche">
            <div class="gouCar">
                <img src="images/gouimg.png" width="19" height="20" style="position:relative;top:6px;"/>&nbsp;|&nbsp;
                <strong class="red">0</strong>&nbsp;件&nbsp;|
                <strong class="red">￥ 0.00</strong>
                <a href="order.html">去结算</a> <img src="images/youjian.jpg" width="5" height="8"/>
            </div><!--gouCar/-->
            <div class="myChunlv">
                <a href="vip.html"><img src="images/mychunlv.jpg" width="112" height="34"/></a>
            </div><!--myChunlv/-->
        </div><!--gouwuche/-->
    </div><!--lsg/-->
    <div class="pnt">
        <div class="pntLeft">
            <h2 class="Title">所有商品分类
                <ul class="InPorNav">
                    <li><a href="product.html">纸杯系列</a>
                        <div class="chilInPorNav">
                            <a href="#">单层热饮杯</a>
                            <a href="#">双层中空杯</a>
                            <a href="#">瓦楞隔热杯</a>
                            <a href="#">双淋膜冷饮杯</a>
                            <a href="#">爆米花桶</a>
                            <a href="#">纸碗</a>
                            <a href="#">冰淇淋纸杯</a>
                            <a href="#">PS杯盖</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">PET系列</a>
                        <div class="chilInPorNav">
                            <a href="#">PET透明杯</a>
                            <a href="#">PET透明盖</a>
                            <a href="#">PET透明沙拉盒</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">饮品杯配套系列</a>
                        <div class="chilInPorNav">
                            <a href="#">杯袖</a>
                            <a href="#">环保纸浆杯托</a>
                            <a href="#">纸杯打包袋</a>
                            <a href="#">吸管</a>
                            <a href="#">搅拌棒</a>
                            <a href="#">杯盖</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">纸浆环保餐具系列</a>
                        <div class="chilInPorNav">
                            <a href="#">纸碟</a>
                            <a href="#">纸碗</a>
                            <a href="#">纸浆带盖汤碗</a>
                            <a href="#">连体餐盒</a>
                            <a href="#">分体餐盒</a>
                            <a href="#">纸浆沙拉盒</a>
                            <a href="#">纸托盘</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">纸餐盒系列</a>
                        <div class="chilInPorNav">
                            <a href="#">圆底纸餐盒</a>
                            <a href="#">方底纸餐盒</a>
                            <a href="#">三明治纸盒</a>
                            <a href="#">蛋糕盒</a>
                            <a href="#">其他纸餐盒</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">刀叉勺餐具</a>
                        <div class="chilInPorNav">
                            <a href="#">PS刀叉勺系列</a>
                            <a href="#">PLA刀叉勺系列</a>
                            <a href="#">淀粉刀叉勺系列</a>
                            <a href="#">搅拌棒/吸管</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">生活用纸</a>
                        <div class="chilInPorNav">
                            <a href="#">餐巾纸</a>
                            <a href="#">抽纸</a>
                            <a href="#">卫生纸</a>
                            <a href="#">擦手纸</a>
                            <a href="#">其他纸类</a>
                        </div><!--chilLeftNav/-->
                    </li>
                    <li><a href="product.html">纸袋/环保打包袋</a>
                        <div class="chilInPorNav">
                            <a href="#">纸袋</a>
                            <a href="#">环保淀粉塑料袋</a>
                            <a href="#">PLA塑料袋</a>
                            <a href="#">食品袋</a>
                        </div><!--chilLeftNav/-->
                    </li>
                </ul><!--InPorNav/-->
            </h2>
        </div><!--pntLeft/-->
        <div class="pntRight">
            <ul class="nav">
                <li><a href="index.html">商城首页</a></li>
                <li class="navCur"><a href="product.html">促销中心</a></li>
                <li><a href="vip.html">会员中心</a></li>
                <li><a href="help.html">帮助中心</a></li>
                <div class="clears"></div>
                <div class="phone">TEL：021-12345678</div>
            </ul><!--nav/-->
        </div><!--pntRight/-->
        <div class="clears"></div>
    </div><!--pnt/-->
    <div class="positions">
        当前位置：<a href="index.html">首页</a> &gt; <a href="#" class="posCur">促销商品</a>
    </div><!--positions/-->
    <div class="cont">
        <div class="contLeft">
            <ul class="leftPorNav">
                <li><a href="product.html">纸杯系列</a>
                    <div class="chilInPorNav">
                        <a href="#">单层热饮杯</a>
                        <a href="#">双层中空杯</a>
                        <a href="#">瓦楞隔热杯</a>
                        <a href="#">双淋膜冷饮杯</a>
                        <a href="#">爆米花桶</a>
                        <a href="#">纸碗</a>
                        <a href="#">冰淇淋纸杯</a>
                        <a href="#">PS杯盖</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">PET系列</a>
                    <div class="chilInPorNav">
                        <a href="#">PET透明杯</a>
                        <a href="#">PET透明盖</a>
                        <a href="#">PET透明沙拉盒</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">饮品杯配套系列</a>
                    <div class="chilInPorNav">
                        <a href="#">杯袖</a>
                        <a href="#">环保纸浆杯托</a>
                        <a href="#">纸杯打包袋</a>
                        <a href="#">吸管</a>
                        <a href="#">搅拌棒</a>
                        <a href="#">杯盖</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">纸浆环保餐具系列</a>
                    <div class="chilInPorNav">
                        <a href="#">纸碟</a>
                        <a href="#">纸碗</a>
                        <a href="#">纸浆带盖汤碗</a>
                        <a href="#">连体餐盒</a>
                        <a href="#">分体餐盒</a>
                        <a href="#">纸浆沙拉盒</a>
                        <a href="#">纸托盘</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">纸餐盒系列</a>
                    <div class="chilInPorNav">
                        <a href="#">圆底纸餐盒</a>
                        <a href="#">方底纸餐盒</a>
                        <a href="#">三明治纸盒</a>
                        <a href="#">蛋糕盒</a>
                        <a href="#">其他纸餐盒</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">刀叉勺餐具</a>
                    <div class="chilInPorNav">
                        <a href="#">PS刀叉勺系列</a>
                        <a href="#">PLA刀叉勺系列</a>
                        <a href="#">淀粉刀叉勺系列</a>
                        <a href="#">搅拌棒/吸管</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">生活用纸</a>
                    <div class="chilInPorNav">
                        <a href="#">餐巾纸</a>
                        <a href="#">抽纸</a>
                        <a href="#">卫生纸</a>
                        <a href="#">擦手纸</a>
                        <a href="#">其他纸类</a>
                    </div><!--chilLeftNav/-->
                </li>
                <li><a href="product.html">纸袋/环保打包袋</a>
                    <div class="chilInPorNav">
                        <a href="#">纸袋</a>
                        <a href="#">环保淀粉塑料袋</a>
                        <a href="#">PLA塑料袋</a>
                        <a href="#">食品袋</a>
                    </div><!--chilLeftNav/-->
                </li>
            </ul><!--InPorNav/-->
        </div><!--contLeft/-->
        <div class="contRight" style="border:0;">
            <div class="proBox">
                <div id="tsShopContainer">
                    <div id="tsImgS"><img class="Picture" width="300" height="300"/></div>
                    <div id="tsPicContainer">
                        <div id="tsImgSArrL" onclick="tsScrollArrLeft()"></div>
                        <div id="tsImgSCon">
                            <ul>
                                <li onclick="showPic(0)" rel="MagicZoom" class="tsSelectImg"><img class="Picture"
                                                                                                  height="42"
                                                                                                  width="42"/></li>
                                <li onclick="showPic(1)" rel="MagicZoom" class="tsSelectImg"><img id="Picture1"
                                                                                                  height="42"
                                                                                                  width="42"/></li>
                            </ul>
                        </div>
                        <div id="tsImgSArrR" onclick="tsScrollArrRight()"></div>
                    </div>
                    <img class="MagicZoomLoading" width="16" height="16" src="images/loading.gif" alt="Loading..."/>
                    <script src="js/ShopShow.js"></script>
                </div><!--tsShopContainer/-->
                <div class="proBoxRight">
                    <h3 class="proTitle"></h3>
                    <div>商品编号：<span id="pnoid"></span></div>
                    <div id="type">商品类型：</div>
                    <div>会员价：<strong class="red" id="price"></strong></div>
                    <div>库存：<span id="sallary1"></span><strong class="green" id="sallary2">[有货] </strong></div>
                    <ul class="rongliang">
                        <li>100ml</li>
                        <div class="clears"></div>
                    </ul>
                    <div class="shuliang2">
                        数量： <input type="text" value="1" id="shuliang2"/>
                    </div><!--shuliang2/-->
                    <div class="gc">
                        <a href="#"><img src="images/goumai.png" width="117" height="36" id="tianjia"/></a>&nbsp;&nbsp;
                        <a href="#"><img src="images/shoucang.png" width="117" height="36"/></a>
                    </div><!--gc/-->
                </div><!--proRight/-->
                <div class="clears"></div>
            </div><!--proBox/-->

            <ul class="fangyuan">
                <li>商品描述</li>
                <li>商品参数</li>
                <li id="coomment">商品评论</li>
                <div class="clears">
                </div>
            </ul><!--fangyuan/-->

            <div class="fangList">
                <div class="fangPar" id="fangPar">

                </div><!--fangPar/-->
            </div><!--fangList/-->
            <div class="fangList">
                商品参数
            </div><!--fangList/-->


            <div class="fangList">
                <table class="vipAdress">
                    <thead>
                    <tr>
                        <td>评价编号</td>
                        <td>评价星级</td>
                        <td>评价商品</td>
                        <td>评价人</td>
                        <td>评价内容</td>
                    </tr>
                    </thead>


                    <tbody id="tcomment">


                    </tbody>

                </table>

                <div class="text-right">
                    <div class="btn-group" style="display: inline-block">
                        <button type="button" class="btn btn-group-sm" id="first">首页</button>
                        <button type="button" class="btn btn-group-sm" id="last">上一页</button>
                        <button type="button" class="btn btn-group-sm" id="next">下一页</button>
                        <button type="button" class="btn btn-group-sm" id="end">末页</button>
                        <button type="button" class="btn btn-group-sm" id="speak">我要评论。。</button>


                        <div class="address" id="coom">
                            <div class="addList">
                                <label><span class="red">* </span>评价内容:</label>
                                <input placeholder="请输入评价内容" type="text" id="comm_text"/>
                            </div><!--addList-->

                            <div class="addList"">
                                <label><span class="red">* </span>评价星级:</label>
                                <div id="star" style="top:-10px;"></div>
                            </div><!--addList-->


                            <div class="addList2">
                                <!--<input type="image" id="address_add" src="images/queren.jpg" width="100" height="32"/>-->
                                <button type="button" id="comm_add">确认评论</button>
                            </div><!--addList2/-->
                        </div><!--address/-->
                    </div>


                </div>


            </div><!--fangList/-->


            <div class="fangList">
                <img src="images/rdPro1.jpg" width="132" height="129"/><br/><br/>
                <img src="images/rdPro2.jpg" width="132" height="129"/><br/><br/>
                <img src="images/rdPro3.jpg" width="132" height="129"/><br/><br/>
                <img src="images/rdPro4.jpg" width="132" height="129"/><br/><br/>
                <img src="images/rdPro5.jpg" width="132" height="129"/><br/><br/>
            </div><!--fangList/-->
        </div><!--contRight/-->
        <div class="clears"></div>
    </div><!--cont/-->
    <div class="inHelp">
        <div class="inHLeft">
            <h4>帮助中心</h4>
            <ul class="inHeList">
                <li><a href="help.html">购物指南</a></li>
                <li><a href="help.html">支付方式</a></li>
                <li><a href="help.html">售后服务</a></li>
                <li><a href="about.html">企业简介</a></li>
                <div class="clears"></div>
            </ul><!--inHeList/-->
        </div><!--inHLeft/-->
        <div class="inHLeft">
            <h4>会员服务</h4>
            <ul class="inHeList">
                <li><a href="reg.html">会员注册</a></li>
                <li><a href="login-register.html">会员登录</a></li>
                <li><a href="order.html">购物车</a></li>
                <li><a href="order.html">我的订单</a></li>
                <div class="clears"></div>
            </ul><!--inHeList/-->
        </div><!--inHLeft/-->
        <div class="inHRight">
            <h4>全国统一免费服务热线</h4>
            <div class="telBox">400-0000-0000</div>
            <div class="weibo">
                <wb:follow-button uid="2991975565" type="red_1" width="67" height="24"></wb:follow-button>
            </div>
        </div><!--inHRight/-->
        <div class="clears"></div>
    </div><!--inHelp/-->
    <div class="footer">
        <p>
            <a href="#">进入17官网</a>&nbsp;|&nbsp;
            <a href="index.html">商城首页</a>&nbsp;|&nbsp;
            <a href="product.html">促销中心</a>&nbsp;|&nbsp;
            <a href="order.html">我的订单</a>&nbsp;|&nbsp;
            <a href="new.html">新闻动态</a>&nbsp;|&nbsp;
            <a href="login.html">会员中心</a>&nbsp;|&nbsp;
            <a href="help.htmll">帮助中心</a>
        </p>
        <p>
            版权所有：上海17实业有限公司 版权所有 Copyright 2010-2015 沪ICP备00000000号 <a href="http://www.mycodes.net/" target="_blank">源码之家</a>
        </p>
    </div><!--footer/-->
</div><!--mianCont/-->
<a href="#" class="backTop">&nbsp;</a>
<script src="js/layer/layui.all.js"></script>
<script>
    var star = 0;
    var url = location.href;
    var params = url.split('?')[1];
    var pno = params.split('=')[1];
    var currPage = 1;
    var cool = 1;
    $(function () {
        pnoloading(pno);
        seletAddress();
        layui.use('rate', function(){
            var rate = layui.rate;
            //渲染
            var ins1 = rate.render({
                elem: '#star',//绑定元素
                choose: function(value){
                    if(value == 5){
                        star=5;
                    }else if(value == 4){
                        star=4;
                    }else if(value == 3){
                        star=3;
                    }else if(value == 2){
                        star=2;
                    }else {
                        star=1;
                    }
                    console.log(star);
                }
            });
        });
    })
    $(function () {
        $('#coomment').click(function () {
            seletAddress();
        })
        $('#next').click(function () {
            if (currPage >= cool) {
                currPage = cool;
                seletAddress();
            } else {
                currPage++
                seletAddress();
            }
        })

        $('#first').click(function () {
            currPage = 1;
            seletAddress();

        })
        $('#end').click(function () {
            currPage = cool;
            seletAddress();

        })
        $('#last').click(function () {
            if (currPage == 1) {
                seletAddress();
            } else {
                currPage--;
                seletAddress();
            }
        })

    })
    //加入购物车
    //对应加载
    function pnoloading(pno) {
        $.getJSON('query_type_id.do', {pno: pno}, function (data) {
            $('#pnoid').text(data.product.pno);
            $('.proTitle').text(data.product.pname);
            $('#price').text("¥" + data.product.price);
            $('#sallary1').text(data.product.sallary);
            $('.rongliang li').text(data.product.spec);
            $('.Picture').attr("src", baseUrl + data.product.picture);
            $('#Picture1').attr("src", baseUrl + data.product.src)
            $('#type').text(data.product.type);
            $('#fangPar').text(data.product.describes);
            if (data.product.sallary == 0) {
                $('#sallary2').attr("class", "red");
                $('#sallary2').text("[缺货]");
            }
            $("#tianjia").click(function () {
                $.getJSON('add_cart', {
                    pno: data.product.pno,
                    price: data.product.price,
                    count:$('#shuliang2').val(),
                }, function () {
                 location.href="order.html";
                })
            });
        })
    }

    //查询评价
    function seletAddress() {
        $('tbody').empty();
        $.ajax({
            url: 'select_comment',
            data: {"currPage": currPage},
            dataType: 'json',
            type: 'post',
            success: function (data) {
                if (data.code == 200) {
                    cool = data.pager.totalPage;
                    $.each(data.result, function (index, obj) {
                        var tr = $('<tr></tr>');
                        var td2 = $('<td></td>').text(obj.star);
                        var td1 = $('<td></td>').text(obj.comno);
                        var td3 = $('<td></td>').text(obj.pno);
                        var td4 = $('<td></td>').text(obj.uno);
                        var td5 = $('<td></td>').text(obj.ctext);
                        tr.append(td1).append(td2).append(td3).append(td4).append(td5);
                        $('#tcomment').append(tr);

                    })
                }
            }

        })

    }


    $('#speak').click(function () {
        $('#coom').attr("style", "display:block");
        $('#comm_add').click(function () {
            console.log($('#pnoid').text());
            $.ajax({
                url: 'add_comment',
                data: {
                    "ctext": $('#comm_text').val(),
                    "star": star,
                    "pno":$('#pnoid').text(),
                },
                dataType: 'json',
                type: 'post',
                success: function (data) {
                    if (data.code == 200) {
                        $('#coom').attr("style", "display:none");
                        seletAddress();
                    }

                }


            })
        })

    })


</script>
<script src="js/global.js"></script>

</body>
</html>
